﻿using System.Runtime.Serialization;

namespace TimeTravel.Components
{
    /// <summary>
    /// 新闻信息
    /// </summary>
    [DataContract]
    public class RecentNewInfo : BaseComponent
    {
        /// <summary>
        /// 新闻标题
        /// </summary>
        [DataMember(Name = "title")]
        public string Title { get; set; }
        /// <summary>
        /// 新闻主体
        /// </summary>
        [DataMember(Name = "body")]
        public string Body { get; set; }
        /// <summary>
        /// 发布日期（时间戳格式）
        /// </summary>
        [DataMember(Name = "date")]
        public int Date { get; set; }
        /// <summary>
        /// 排序（越大越靠前。默认为0）
        /// </summary>		
        private int _sort;
        [DataMember(Name = "sort")]
        public int Sort
        {
            get { return _sort; }
            set 
            {
                if (value<0)
                {
                    value = 0;
                }
                _sort = value;
            }
        }
        /// <summary>
        /// 查看次数
        /// </summary>
        [DataMember(Name = "click")]
        public int Click { get; set; }
        /// <summary>
        /// 发布者
        /// </summary>		
        [DataMember(Name = "user")]
        public SysUserInfo User { get; set; }
    }
}